package com.windward.vii.dao.mapper;

import com.windward.vii.dao.entity.AssetPlatformProfit;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface AssetPlatformProfitMapper {
    @Delete({
        "delete from asset_platform_profit",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into asset_platform_profit (id, income_id, ",
        "type, coin, rate, ",
        "create_time, chat_id, ",
        "gift_id, consumer_uid, ",
        "anchor_uid)",
        "values (#{id,jdbcType=BIGINT}, #{incomeId,jdbcType=BIGINT}, ",
        "#{type,jdbcType=TINYINT}, #{coin,jdbcType=BIGINT}, #{rate,jdbcType=DECIMAL}, ",
        "#{createTime,jdbcType=TIMESTAMP}, #{chatId,jdbcType=BIGINT}, ",
        "#{giftId,jdbcType=BIGINT}, #{consumerUid,jdbcType=BIGINT}, ",
        "#{anchorUid,jdbcType=BIGINT})"
    })
    int insert(AssetPlatformProfit record);

    int insertSelective(AssetPlatformProfit record);

    @Select({
        "select",
        "id, income_id, type, coin, rate, create_time, chat_id, gift_id, consumer_uid, ",
        "anchor_uid",
        "from asset_platform_profit",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @ResultMap("BaseResultMap")
    AssetPlatformProfit selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(AssetPlatformProfit record);

    @Update({
        "update asset_platform_profit",
        "set income_id = #{incomeId,jdbcType=BIGINT},",
          "type = #{type,jdbcType=TINYINT},",
          "coin = #{coin,jdbcType=BIGINT},",
          "rate = #{rate,jdbcType=DECIMAL},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "chat_id = #{chatId,jdbcType=BIGINT},",
          "gift_id = #{giftId,jdbcType=BIGINT},",
          "consumer_uid = #{consumerUid,jdbcType=BIGINT},",
          "anchor_uid = #{anchorUid,jdbcType=BIGINT}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(AssetPlatformProfit record);
}